package com.gameLogic.manager
{
	import com.gameLogic.actor.Player;
	import com.gameLogic.scene.SceneManager;
	import com.gameLogic.utils.GameConfig;
	
	import laya.events.Event;
	import laya.maths.Point;

	public class InputManager
	{
		
		public function InputManager()
		{
			
		}
		
		public function init():void
		{
			Laya.stage.on(Event.MOUSE_DOWN, this, mouseHandler);
			Laya.stage.on(Event.KEY_DOWN, this, onKeyDown);
		}
		
		private function onKeyDown(e:*=null):void
		{
			if(e["keyCode"] == 81)
			{
				trace("keyboard Q Pressed");
			}
			else if(e["keyCode"] == 87)
			{
				
			}
		}
		
		private function mouseHandler(e:Event):void
		{
			//检查是否可以行走
			var pos:Point = SceneManager.instance.getMousePos();
			Player.instance.moveTo(pos);
		}
		
		private static var _instance:InputManager
		public static function get instance():InputManager
		{
			if(!_instance){ _instance = new InputManager(); }
			return _instance;
		}
		
	}
}